package com.atguigu.userprofile.common.dao

import com.atguigu.userprofile.common.bean.TagInfo
import com.atguigu.userprofile.common.util.MySQLUtil

object TagInfoDAO {


  def  getTagInfoByTaskId(taskId:String): TagInfo ={
    val tagSQL=s" select * from tag_info  where tag_task_id='$taskId'"

    val maybeTagInfo: Option[TagInfo] = MySQLUtil.queryOne(tagSQL, classOf[TagInfo], true)

    if(maybeTagInfo!=null){
      val tagInfo: TagInfo = maybeTagInfo.get
      println(tagInfo)
      tagInfo
    }else{
      null
    }

  }

  def getTagInfoWithOnList(): List[TagInfo] ={
       val sql=
         s"""
            |select ti.* from  tag_info  ti join task_info tk on ti.tag_task_id=tk.id
            |where tk.task_status='1'
            |""".stripMargin

        val tagInfoList:List[TagInfo]=MySQLUtil.queryList(sql,classOf[TagInfo],true)
        tagInfoList
  }


}
